package com.boot.security.server.dao.record;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.record.TswSyceeRecord;

@Mapper
public interface TswSyceeRecordDao {

    @Select("select * from tsw_sycee_record t where t.id = #{id}")
    TswSyceeRecord getById(Long id);

    @Delete("delete from tsw_sycee_record where id = #{id}")
    int delete(Long id);

    int update(TswSyceeRecord tswSyceeRecord);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into tsw_sycee_record(user_id, water_body, water_source, water_type, price_sycee, method_payment, valid_state, income_state, transaction_number, cearing_time, order_id, description, create_time, water_note, water_remark) values(#{userId}, #{waterBody}, #{waterSource}, #{waterType}, #{priceSycee}, #{methodPayment}, #{validState}, #{incomeState}, #{transactionNumber}, #{cearingTime}, #{orderId}, #{description}, #{createTime}, #{waterNote}, #{waterRemark})")
    int save(TswSyceeRecord tswSyceeRecord);
    
    int count(@Param("params") Map<String, Object> params);

    List<TswSyceeRecord> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
